<template>
  <div class="ai-robot font14">
     <p>{{$t('configLazyLoad.robotSeven.robotJumpTip3')}}<span @click="openRisk" style="color: #459ae9;cursor: pointer">{{$t('configLazyLoad.robotSeven.robotJumpTip2')}}</span></p>
  </div>
</template>

<script>
  import bus from '@/store/eventBus'
  export default {
    name: 'riskConfig',
    data () {
      return {
      }
    },
    methods: {
      openRisk () {
        this.$store.dispatch('m7RiskLogin', {}).then(res => {
          if (res.success && res.sessionId) {
            let user = this.$store.state.session.user
            let account = user ? user.account : ''
            let url = res.url + '?sessionId=' + res.sessionId + '&account=' + account
            console.log(url)
            window.open(url, '_blank')
          }
        })
      }
    },
    mounted () {
      bus.$on('openRiskBus', () => {
        this.openRisk()
      })
      this.openRisk()
    },
    beforeDestroy () {
      bus.$off('openRiskBus')
    }
  }
</script>

<style scoped lang="stylus">
  @import "./../../../../assets/common.styl"
  .ai-robot
    background $c-back
    text-align center
    margin 20px auto
</style>
